#  -*-coding:utf8 -*-
#用于把单词列表随机平均分配成多个段 便于每天记忆
from random import shuffle
def allocate(in_name,out_name):
	with open(in_name,'r',encoding='UTF-8') as f:#单词源文件 一个单词一行
		content_list=f.readlines()#一次读取文件所有内容，按行返回一个list
	shuffle(content_list)#打乱list
	result=[]
	b=0
	#content_list total len=630=21*30
	for n in range(30):
		result.append([])
		for m in range(21):
			result[n].append(content_list[b])
			b+=1
			#print(b)
	with open(out_name,'w',encoding='UTF-8') as f:
		for n in result:
			for m in n:
				f.write(m)
			f.write('\n')
allocate('chinese_notional_words.txt','words_allocated.txt')
#chinese_notional_words.txt 从网上找的古汉语实词列表
#words_allocated.txt 输出的txt文件
